import request from '@/utils/request'

// api地址
const api = {
  userInfo: 'user/info',
  userInfoById: 'user/infoById',
  assets: 'user/assets',
  bindMobile: 'user/bindMobile',
  personal: 'user/personal',
  recList:'user/recList',
  team:'user/team',
  bonusFlow:'user/bonusFlow',
  decCoinFlow:'user/decCoinFlow',
  shoppingCoinFlow:'user/shoppingCoinFlow',
  bonusToShoppingCoin:'user/bonusToShoppingCoin',
  shoppingCoinTransferToOhter:'user/shoppingCoinTransferToOhter',
  withdrawApply:'user/withdrawApply',
  withdrawLog:'user/withdrawLog',
  userInfoByMobile: 'user/infoByMobile',
   moneyFlow:'user/moneyFlow',
   moneyToShoppingCoin:'user/moneyToShoppingCoin',
	coinToShoppingCoin:'user/coinToShoppingCoin',
}

// 当前登录的用户信息
export const info = (param, option) => {
  const options = {
    isPrompt: true, //（默认 true 说明：本接口抛出的错误是否提示）
    load: true, //（默认 true 说明：本接口是否提示加载动画）
    ...option
  }
  return request.get(api.userInfo, param, options)
}

// 用户信息
export const infoById = (param, option) => {
  const options = {
    isPrompt: true, //（默认 true 说明：本接口抛出的错误是否提示）
    load: true, //（默认 true 说明：本接口是否提示加载动画）
    ...option
  }
  return request.get(api.userInfoById, param, options)
}

// 用户信息
export const infoByMobile = (param, option) => {
  const options = {
    isPrompt: true, //（默认 true 说明：本接口抛出的错误是否提示）
    load: true, //（默认 true 说明：本接口是否提示加载动画）
    ...option
  }
  return request.get(api.userInfoByMobile, param, options)
}

// 账户资产
export const assets = (param, option) => {
  return request.get(api.assets, param, option)
}

// 绑定手机号
export const bindMobile = (data, option) => {
  return request.post(api.bindMobile, data, option)
}

// 修改个人信息（头像昵称）
export const personal = (data, option) => {
  return request.post(api.personal, data, option)
}

// 推荐人列表
export const recList = (param, option) => {
  const options = {
    isPrompt: true, //（默认 true 说明：本接口抛出的错误是否提示）
    load: true, //（默认 true 说明：本接口是否提示加载动画）
    ...option
  }
  return request.get(api.recList, param, options)
}

// 团队树
export const team = (param, option) => {
  return request.get(api.team, param, option)
}

// 积分流水
export const bonusFlow = (param, option) => {
  return request.get(api.bonusFlow, param, option)
}

// 购物券流水
export const decCoinFlow = (param, option) => {
  return request.get(api.decCoinFlow, param, option)
}

// 购物币流水
export const shoppingCoinFlow = (param, option) => {
  return request.get(api.shoppingCoinFlow, param, option)
}

// 积分转购物币
export const bonusToShoppingCoin = (data, option) => {
  return request.post(api.bonusToShoppingCoin, data, option)
}

// 购物券转购物币
export const coinToShoppingCoin = (data, option) => {
  return request.post(api.coinToShoppingCoin, data, option)
}

// 积分转账
export const shoppingCoinTransferToOhter = (data, option) => {
  return request.post(api.shoppingCoinTransferToOhter, data, option)
}

// 申请提现
export const withdrawApply = (data, option) => {
  return request.post(api.withdrawApply, data, option)
}

// 提现明细
export const withdrawLog = (param, option) => {
  return request.get(api.withdrawLog, param, option)
}

// 货款流水
export const moneyFlow = (param, option) => {
  return request.get(api.moneyFlow, param, option)
}

// 货款转购物币
export const moneyToShoppingCoin = (data, option) => {
  return request.post(api.moneyToShoppingCoin, data, option)
}